package designpattern.demo.creational.singletonpattern;

/**
 * 多线程环境下的懒汉式单例模式(简单加锁)
 *
 * @author ywq
 */

public class SingleLazy2 {

    private static SingleLazy2 s = null;

    private SingleLazy2() {
    }

    public static SingleLazy2 getInstance() {
        synchronized (SingleLazy2.class) {
            if (s==null) {

                if (s==null)
                    //--->A;
                    s = new SingleLazy2();
            }
        }
        return s;

    }


}
